﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using eTerm.PlugIn.NCore;
using eTerm.MsSql.DbProvider;
using eTerm.ASynClientSDK;
using System.Text.RegularExpressions;

namespace eTerm.PlugIn.AutoSeatDetail
{
    public class PNRModePlugIn : DetailModePlugIn, IPlugIn
    {
        /// <summary>
        /// 差件名称
        /// </summary>
        /// <value>用于日志记录的插件名称.</value>
        public override string PlugInName
        {
            get
            {
                return @"PNR编码方式预订航班";
            }
        }

        /// <summary>
        /// 插件执行顺序
        /// </summary>
        /// <value>The execute order.</value>
        public override int ExecuteOrder
        {
            get
            {
                return base.ExecuteOrder-1;
            }
            protected set
            {
                base.ExecuteOrder = value;
            }
        }

        /// <summary>
        /// 准备数据队列.
        /// </summary>
        protected override void PrepareQueue()
        {
            PnrRequire.All().Where(l => !string.IsNullOrEmpty(l.PnrCode) && (l.StatusId & (int)(PNRRequireStatus.ERROR | PNRRequireStatus.APPROVED)) != 0).OrderBy(l => l.RecordDate).ToList().ForEach(l =>
            {
                __PnrQueue.Enqueue(l);
            });
        }

    }
}
